import {UserProfilesAPI} from '@/request/api'
export default {
    namespaced: true,
    state: {
        userInfo: {
            nickName:"昵称",
            coin:"--",
            headImg:require("../../assets/img/service.848ec511.png")
        },
        cartTotal:""
    },
    getters: {
    },
    mutations: {
        changeUserInfo(state, payload) {
            state.userInfo = payload.userInfo;
            state.cartTotal=payload.cartTotal;
        },
        initUserInfo(state,payload){
            state.userInfo={
                nickName:"昵称",
                coin:"--",
                headImg:require("../../assets/img/service.848ec511.png")
            },
            state.cartTotal=""
        }
    },
    actions: {
        async asyncChangeUserInfo({commit}){
            let res=await UserProfilesAPI()
            
            commit("changeUserInfo",res.data)
        }
    },
}